// 定义一个user的状态管理
export const platformState = defineStore('channelsystem', {
    // 定义状态
    state: () => {
        return {
            openFlag: false,
            expandFlag:false,
            headerFlag: false,
            channelList: [],
            platformSystem: {},
            keywords: []
        }
    },

    // 修改状态
    actions: {
        setOpenFlag(flag) {
            this.openFlag = flag
        },
        setExpandFlag(flag) {
            this.expandFlag = flag
        },
        setHeaderFlag(flag) {
            this.headerFlag = flag
        },
        setData(data) {
            this.channelList = data.channels
            this.platformSystem = data.system
            this.keywords = data.keywords
        }
    },

    getters: {

    },

    //persist定义要做判断，因为localStorage是客户端参数，所以需要加process.client
    persist: process.client && {
        storage: sessionStorage, // sessionStorage/localStorage
        key: 'kva-nuxt-channelsystem', // storage的key
    }
})
